package router

import (
	"blog/internal/controller"
	"github.com/gin-gonic/gin"
)

func SetupRouter(articleCtrl *controller.ArticleController) *gin.Engine {
	r := gin.Default()

	// 全局中间件
	r.Use(gin.Recovery())
	r.Use(gin.Logger())

	// API路由组
	api := r.Group("/api")
	{
		// 文章路由
		articles := api.Group("/articles")
		{
			articles.GET("", articleCtrl.GetAll)
			articles.GET("/:id", articleCtrl.GetByID)
			//articles.POST("", articleCtrl.Create)
			//articles.PUT("/:id", articleCtrl.Update)
			//articles.DELETE("/:id", articleCtrl.Delete)
		}
	}

	return r
}
